Release 10.1A: OpenEdge Application Server:
Developing WebSpeed Applications
Compile-time versus run-time code
Like many languages, SpeedScript includes two basic types of code:
However, as an interpretive language, WebSpeed syntax combines compile-time and run-time components in many more ways than a compiled language like C. The flexibility of this syntax helps implement the rich variety of overridable defaults that characterizes SpeedScript.
Compile-time code
Certain statements exist only to generate r-code when WebSpeed compiles them. These are compile-time statements. That is, they create static data and form buffer resources (frame and field objects) that the run-time statements can reference and modify, but not destroy, during execution.
Compile-time syntax elements
Most compile-time code consists of the following syntax elements:
- Compile-time statements, including SpeedScript statements that begin with the
DEFINEkeyword.- The nonexecutable components of block header statements and
ENDstatements.- Options and phrases associated with compile-time statements, wherever they appear.
- Literal expressions (constants).
- Preprocessor directives and definitions.
Run-time code
Run-time statements use the static resources created by compile-time statements, but can also create, use, and destroy dynamic resources at run time. That is, run-time statements include statements that interact with static resources, dynamic resources, or both. Many run-time statements also include compile-time options. These are options that generate resources at compile time that are later used by the same statements at run time.
Run-time syntax elements
Most run-time code consists of the following syntax elements:
- All statements other than compile-time statements.
- The options and phrases associated with run-time statements, including the executable components of block header statements, except those options and phrases that are also associated with compile-time statements (such as Format and Frame phrases).
The block header statements of iterative blocks (
DO,FOR, andREPEATblocks) all have executable components. These components enforce the iteration conditions (when the block starts and stops executing) and select what database data isavailable to the block.Note: WebSpeed distinguishes variables from their field object representation. However, the references to variables (or fields) in the- Assignment statements and nonliteral expressions (variables, functions, attributes, and methods).
ASSIGNand{&DISPLAY}statements reference both the variables and their field object representations because WebSpeed moves data between them implicitly at run time.How compile-time and run-time code interact
Because SpeedScript is a run-time interpreted language, it can combine compile-time and run-time code in a number of interesting and powerful ways.
As noted earlier, some run-time statements can also include compile-time options. Thus, you can define a frame to display data using a
DEFINEFRAMEstatement, then add options to that static definition using Frame phrase options in subsequent run-time statements, such asFORand{&DISPLAY}.In this example, the data fields, frame type, and title for frame alpha are all defined at compile time and in three different statements:
A powerful example of the interaction between compile-time and run-time code is the use of the
VALUEoption in a number of run-time statements. Insample6, theVALUEoption allows you to use a run-time expression (proc-name[proci]) to provide a compile-time object name:
In the
Note: The proceduresRUNstatement, the object name is the name of a procedure to execute.sample7thus shows how the same three procedures can be executed using static compile-time object names or using object names evaluated by theVALUEoption at run time.proc1.p,proc2.p, andproc3.pexist for illustration only.
|
Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |